FROM alpine:edge
#
Maintainer Zxx99(1032869152@qq.com)

# 安装lib
RUN rm -f /var/cache/apk/* \
	&& apk update && apk upgrade \
	&& apk add bash \
	curl ca-certificates \
	openssl openssh git tzdata openntpd nano \
	autoconf build-base linux-headers libaio-dev pcre-dev \
	libevent-dev openssl-dev

# 安装php7 
RUN apk add	php7 \
	php7-dev \
	php7-opcache \
	php7-common  \
	php7-mysqlnd \
	php7-phar \
	php7-json \
	php7-iconv \
	php7-openssl \
	php7-ftp \
	php7-mcrypt \
	php7-mbstring \
	php7-soap \
	php7-gmp \
	php7-pdo \
	php7-pdo_odbc \
	php7-dom \
	php7-pdo \
	php7-zip \
	php7-mysqli \
	php7-sqlite3 \
	php7-pdo_pgsql \
	php7-bcmath \
	php7-gd \
	php7-odbc \
	php7-pdo_mysql \
	php7-pdo_sqlite \
	php7-gettext \
	php7-xmlreader \
	php7-xmlwriter \
	php7-simplexml \
	php7-tokenizer \
	php7-xmlrpc \
	php7-bz2 \
	php7-curl \
	php7-ctype \
	php7-session \
	php7-redis \
	php7-sockets \
	php7-zlib \
	php7-pcntl \
	php7-posix \
	&& cp /usr/bin/php7 /usr/bin/php 

# 安装event扩展
RUN	wget https://pecl.php.net/get/event-2.3.0.tgz && \
	tar -xvf event-2.3.0.tgz && cd event-2.3.0/ \
	&& phpize && ./configure && make && make install \
	&& cp /event-2.3.0/modules/event.so /usr/lib/php7/modules/event.so \
	&& echo "extension=event.so" > /etc/php7/conf.d/event.ini \
	&& cd .. && rm -rf event-2.3.0 && rm event-2.3.0.tgz

# 清理数据
RUN rm -f /var/cache/apk/*

# Add apache to run and configure
# RUN mkdir /run/apache2 \
#     && sed -i "s/#LoadModule\ rewrite_module/LoadModule\ rewrite_module/" /etc/apache2/httpd.conf \
#     && sed -i "s/#LoadModule\ session_module/LoadModule\ session_module/" /etc/apache2/httpd.conf \
#     && sed -i "s/#LoadModule\ session_cookie_module/LoadModule\ session_cookie_module/" /etc/apache2/httpd.conf \
#     && sed -i "s/#LoadModule\ session_crypto_module/LoadModule\ session_crypto_module/" /etc/apache2/httpd.conf \
#     && sed -i "s/#LoadModule\ deflate_module/LoadModule\ deflate_module/" /etc/apache2/httpd.conf \
#     && sed -i "s#^DocumentRoot \".*#DocumentRoot \"/app/public\"#g" /etc/apache2/httpd.conf \
#     && sed -i "s#/var/www/localhost/htdocs#/app/public#" /etc/apache2/httpd.conf \
#     && printf "\n<Directory \"/app/public\">\n\tAllowOverride All\n</Directory>\n" >> /etc/apache2/httpd.conf

# RUN mkdir /app && mkdir /app/public && \
# 	chown -R apache:apache /app && \
# 	chmod -R 755 /app && mkdir /bootstrap
# ADD start.sh /bootstrap/
# RUN chmod +x /bootstrap/start.sh

# EXPOSE 80
# ENTRYPOINT ["/bootstrap/start.sh"]